<?php

require("config.php");
require_login();

$id = get_get("id");

if (!$id) {
	echo "没有id";
	exit;
}

$result = $db->query("select id from po_blog where id=%d and username='%s'", $id, $user['username']);
if ($result && $row=$db->fetch_assoc($result)) {
	$result2 = $db->query("delete from po_blog where id=%d and username='%s'", $id, $user['username']);
	if ($result2) {
		$db->query("delete from po_tags where unitid=%d", $id);
		$t->set_file("body", "submit_success.html");
		$t->set_var("T_BURL", URL_ROOT . "myblog.php?user=" . $user['username']);
		$t->set_var("T_BTITLE", "我的文章");
		$t->pparse("out", "body");
		exit;
	} else {
		echo "数据库更新失败";
		exit;
	}
} else {
	echo "没有该文章";
	exit;
}